<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="public/public_css::public_css ('盘点计划')" />

<link rel="stylesheet" type="text/css" th:href="@{/plugin/layui/css/font/iconfont.css}" media="all"/>
<link rel="stylesheet" type="text/css" th:href="@{/plugin/layui/js/layui/css/layui.css}" media="all"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/main.css}" media="all"/>

<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
            <div class="layui-col-xs24">
                <form class="layui-form layui-card-header  layui-card-header-auto" id="searchForm">
                    <input type="hidden" th:value="${planId}" id="planId" name="planId">
                </form>
                <!--列表-->
                <section class="panel panel-padding layui-card-body" >
                    <div class="pro">
                        <table id="table"  class="table text-nowrap" style="word-break:break-all; word-wrap:break-word;"></table>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>





</body>


<script type="text/javascript" th:src="@{/plugin/layui/js/layui/layui.js}"></script>
<script type="text/javascript" th:src="@{/plugin/layui/js/version.js}"></script>
<script th:src="@{/plugin/layui/js/common.js}"></script>
<div th:include="public/public_js::public_js"></div>
<style type="text/css">

</style>
<script>
    //	回车查询
    document.onkeydown = function(event) {
        e = event ? event : (window.event ? window.event : null);
        if (e.keyCode == 13) {
            //执行的方法
            $('#search_button').click();
        }
    };
    layui.use(['list','layer','zzpUtils','jquery','laydate'],function () {
        window.operateEvent = {
            //预检
            "click .confirm": function (e, value, row, index) {//增加地址
                console.info("增加地址");
                confirm(row.id);
            },
        }


        var zzpUtils= layui.zzpUtils,
            $ = layui.jquery,
            layer=layui.layer,
            laydate = layui.laydate;



        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            pagination:true,
            url: '/wmsinventoryplan/getStockCyRw',
            columns: [{
                field: '',
                checkbox: true
            },{
                field: 'asnbh',
                title: 'ASN编号',
                width: 200
            },{
                field: 'goodsBh',
                title: '货品编号',
                width:200
            },{
                field: 'goodsMc',
                title: '货品名称',
                width:200
            },{
                field: 'hppc',
                title: '货品批次'
            },{
                field: 'scrq',
                title: '生产日期'
            },{
                field: 'rksj',
                title: '入库时间'
            },{
                field: 'sxrq',
                title: '失效日期'
            },{
                field: 'lpn',
                title: 'LPN码'
            },{
                field: 'gysmc',
                title: '供应商'
            },{
                field: 'kwmc',
                title: '库位名称'
            },{
                field:'caozuo',
                title: '可用操作',
                events:operateEvent,
                formatter:operateFormatter
            }],
            queryParams: function () {//查询条件
                return  zzpUtils.getFormJson($("#searchForm"));
            },
            detailFormatter: function (row,index) {
                return "这里就没有确定过11";
            },
           /* onDblClickRow:function (row,index) {//双击展示

            }*/

        });



        function operateFormatter(value, row, index) {
            return [
                '<a class="layui-btn layui-btn-xs layui-btn-radius layui-btn-warm  confirm" >确定</a>'

            ].join('')
        }
        $(".inline-search-btn").on('click',function () {
            zzpUtils.refreshTable("#table");
        });



        $('#zyryid').select2({
            ajax: {
                url: "/zxsdwms/wmsqualityinspectionlist/selectYh",
                dataType: 'json',
                type: 'POST',
                contentType: "application/json",
                data: function (params) {
                    var query = {
                        name: params.term
                    };
                    return JSON.stringify(query);
                },
                processResults: function (data) {
                    console.info(data);
                    var arr = new Array();
                    if (data) {
                        for (var i = 0; i < data.length; i++) {
                            arr.push({id: data[i].id, text: data[i].name});
                        }
                    }
                    return {
                        results: arr
                    };
                },
                cache: true
            },
            language: "zh-CN",
            placeholder: '请输入查询字段',
            allowClear: true
        });
        function confirm(id){
            var ids=[];
            ids.push(id);
            console.info(ids);
            zzpUtils.confirm("是否确定调整", function (index) {
                zzpUtils.action({
                    url: "/wmsinventoryplan/tzPlanRw",
                    data: JSON.stringify({ids:ids}),
                    success: function (data) {
                        setTimeout(function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index); //再执行关闭
                            console.info(data);
                            top.layer.msg(data.title + "," + data.message);
                            $table.bootstrapTable('nextPage');
                            //刷新父页面
                        }, 500);
                    }, error: function (xhr, textStatus) {
                        console.log(textStatus);
                        console.log(xhr)
                    }
                })
            })
        }
    });
</script>
</html>